package com.tea.source.dao;

import java.util.List;

import org.springframework.stereotype.Component;

import com.tea.source.model.Production;

@Component("productionDao")
public class ProductionDao extends BaseDao {
	
	public void save(Production pro){
		System.out.println("daoPro");
		hibernateTemplate.save(pro);
	}
	
	public List<Production> load(){
		List<Production> pros = (List<Production>)hibernateTemplate.find("from Production p");
		return pros;
	}
	
	public Production loadById(int id) {
		List<Production> p = (List<Production>)hibernateTemplate.find("from Production p where p.id='"+id+"'");
		
		return p.get(0);
	}

}
